package com.feihao.demoDate;

import java.util.ArrayList;
import java.util.Arrays;

public class ArrayCopy {
    public static void main(String[] args) {


        int[] arr1 ={1,2,3,5,9,8,5,6};

        int [] arr22 = new int[88];
        System.arraycopy(arr1,0,arr22,0,6);
        for (int i : arr22) {
            System.out.print(i +"  ");
        }
















        /*int[] ints = {1,2,3,5,8,6,3,4,5};

        int[] arr = new int[10];

        System.arraycopy(ints,0,arr,1,ints.length);

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+",");
        }


        System.out.println('\'');*/



        int[] int222 = {1,2,3,5,8,6,3,4,5};

        String string = Arrays.toString(int222);
        System.out.println(string);


        StringBuilder stringBuilder = new StringBuilder(string);

        System.out.println(stringBuilder);


        StringBuilder reverse = stringBuilder.reverse();

        System.out.println(reverse);
        String string1 = reverse.toString();
        char[] chars = string1.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            System.out.print(chars[i]+",");
        }


        System.out.println("\n");
        int[] int333 = {1,2,3,5,8,6,3,4,5};

        Arrays.sort(int333);


        Student student1 = new Student(12,"张三");
        Student student2 = new Student(22,"张44");
        Student student3 = new Student(14,"张55");

        ArrayList<Student> students = new ArrayList<>();
        students.add(student1);
        students.add(student2);
        students.add(student3);

        Student max = getMax(student1, student2);
        System.out.println(max);

    }

    //获取两对象中年纪大的对象》
    public static Student getMax(Student student1,Student student2){
        int i = student1.compareTo(student2);
        if (i>=0){
            return student1;
        }else
            return student2;
    }



}

